﻿@page
@model IndexModel
@{
    ViewData["Title"] = "Hosting Startup Sample";
}

<h1>@ViewData["Title"]</h1>

<div class="row">
    <div class="col-md-8">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Consume hosting startup from a bin-deployed library</h3>
            </div>
            <div class="panel-body">
                <h4>Add configuration</h4>
                <p>
                    When an <code>IHostingStartup</code> enhancement is available from an existing library, the types provided by the library can be made available by bin-deploying the library's assembly and adding the hosting startup assembly name to the <code>ASPNETCORE_HOSTINGSTARTUPASSEMBLIES</code> environment variable.
                </p>
                <p>
                    The hosting startup of the class library adds an in-memory configuration provider to the app that specifies values for the service keys shown below.
                </p>
                <h4>Service Keys</h4>
                <ul>
                    <li><b>Development Service Key from Library</b>: @Model.ServiceKey_Development_Library</li>
                    <li><b>Production Service Key from Library</b>: @Model.ServiceKey_Production_Library</li>
                </ul>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-8">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Consume hosting startup from a NuGet package</h3>
            </div>
            <div class="panel-body">
                <h4>Add configuration</h4>
                <p>
                    When an <code>IHostingStartup</code> enhancement is available from an existing NuGet package, the types provided by the package can be made available by referencing the package and adding the hosting startup assembly name to the <code>ASPNETCORE_HOSTINGSTARTUPASSEMBLIES</code> environment variable.
                </p>
                <p>
                    The hosting startup of the NuGet package adds an in-memory configuration provider to the app that specifies values for the service keys shown below.
                </p>
                <h4>Service Keys</h4>
                <ul>
                    <li><b>Development Service Key from Package</b>: @Model.ServiceKey_Development_Package</li>
                    <li><b>Production Service Key from Package</b>: @Model.ServiceKey_Production_Package</li>
                </ul>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-8">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Startup Diagnostics Instructions</h3>
            </div>
            <div class="panel-body">
                <h4>Obtain a list of services</h4>
                <p>
                    When the <code>IHostingStartup</code> implementation's <code>Configure</code> method executes, a factory is registered that implements a method to obtain the app's service collection descriptors. An implementation of <code>IStartupFilter</code> branches the request pipeline for the path <code>/services</code>, which executes a terminal middleware delegate. The delegate produces a webpage showing the app's services using the factory's <code>GetServices</code> method.
                </p>
                <p>
                    To see the services in the service collection of the app, request the <code>/services</code> endpoint from the running app.
                </p>
                <h4>Obtain diagnostic information</h4>
                <p>
                    The implementation of <code>IStartupFilter</code> also registers a middleware, <code>DiagnosticMiddleware</code>, that outputs diagonistic information on the:
                    <ul>
                        <li>Request</li>
                        <li>Connection</li>
                        <li>Headers</li>
                        <li>Environment variables</li>
                    </ul>
                </p>
                <p>
                    To see the diagnostic information from the app, request the <code>/diag</code> endpoint from the running app.
                </p>
            </div>
        </div>
    </div>
</div>
